import request from '../utils/axios-config'

// 获取学生用户分页数据
export function getStudentUserPage(params) {
  return request({
    url: '/admin/studentUser/page',
    method: 'get',
    params
  })
}

// 获取学生用户详情
export function getStudentUserDetail(id) {
  return request({
    url: `/admin/studentUser/detail/${id}`,
    method: 'get'
  })
}

// 创建学生用户
export function createStudentUser(data) {
  return request({
    url: '/admin/studentUser/create',
    method: 'post',
    data
  })
}

// 更新学生用户信息
export function updateStudentUser(data) {
  return request({
    url: '/admin/studentUser/update',
    method: 'put',
    data
  })
}

// 删除学生用户
export function deleteStudentUser(id) {
  return request({
    url: `/admin/studentUser/${id}`,
    method: 'delete'
  })
}

// 更新学生用户状态
export function updateStudentUserStatus(id, status) {
  return request({
    url: `/admin/studentUser/updateStatus/${id}`,
    method: 'put',
    params: { status }
  })
}

// 更新VIP等级
export function updateStudentUserVipLevel(id, vipLevel) {
  return request({
    url: `/admin/studentUser/updateVipLevel/${id}`,
    method: 'put',
    params: { vipLevel }
  })
}

// 根据学号查询学生用户
export function getStudentUserByNo(sno) {
  return request({
    url: `/admin/studentUser/getByStudentNo/${sno}`,
    method: 'get'
  })
}

